#ifndef LOC_TYPE_H
#define LOC_TYPE_H



typedef unsigned char      u8;



typedef signed char        s8;



typedef u8                 TYP_tu8Bool;


/**	If AVRLIB is not used then we will define our own types.
*/
#ifndef AVRLIBTYPES_H

typedef unsigned short int u16;

typedef unsigned long  int u32;

typedef signed short int   s16;

typedef signed long  int   s32;

#endif
/** Byte and bit access definition.
*/
typedef union
{
       struct{
             u8 u8b0 :1;     /* lsb (least significant bit)*/
             u8 u8b1 :1;     /* BIT 1*/
             u8 u8b2 :1;     /* BIT 2*/
             u8 u8b3 :1;     /* BIT 3*/
             u8 u8b4 :1;     /* BIT 4*/
             u8 u8b5 :1;     /* BIT 5*/
             u8 u8b6 :1;     /* BIT 6*/
             u8 u8b7 :1;     /*   msb (most significant bit)*/
             } strBit;         /*   for bit  access */
        u8 u8Byte;             /*   for byte access */
} TYP_tuniPort;

/** Word, byte and bit access definition.
*/
typedef union
{
       struct{
             u8 u8b8 :1;    /*   BIT 8*/
             u8 u8b9 :1;  /*   BIT 9*/
             u8 u8b10 :1; /*   BIT 10*/
             u8 u8b11 :1; /*   BIT 11*/
             u8 u8b12 :1; /*   BIT 12*/
             u8 u8b13 :1; /*   BIT 13*/
             u8 u8b14 :1; /*   BIT 14*/
             u8 u8b15 :1; /*   msb (most significant bit)*/
             u8 u8b0 :1;  /*   lsb (least significant bit)*/
             u8 u8b1 :1;  /*   BIT 1*/
             u8 u8b2 :1;  /*   BIT 2*/
             u8 u8b3 :1;  /*   BIT 3*/
             u8 u8b4 :1;  /*   BIT 4*/
             u8 u8b5 :1;  /*   BIT 5*/
             u8 u8b6 :1;  /*   BIT 6*/
             u8 u8b7 :1;    /*   BIT 7*/
             } strBit;      /*   for bit  access   */
       struct{
             u8 u8high;    /*   Most significant byte */
             u8 u8low;     /*   Least significant byte */
             } strByte;    /*   for byte access */
       u16 u16Word;        /*   for word access */
} TYP_tuniPort16;

/** Double word, word, byte and bit access definition.
*/
typedef union
{
  struct
  {
    u8 u8b24 :1;  /* lsb */
    u8 u8b25 :1;
    u8 u8b26 :1;
    u8 u8b27 :1;
    u8 u8b28 :1;
    u8 u8b29 :1;
    u8 u8b30 :1;
    u8 u8b31 :1;
    u8 u8b16 :1;
    u8 u8b17 :1;
    u8 u8b18 :1;
    u8 u8b19 :1;
    u8 u8b20 :1;
    u8 u8b21 :1;
    u8 u8b22 :1;
    u8 u8b23 :1;
    u8 u8b8 :1;
    u8 u8b9 :1;
    u8 u8b10 :1;
    u8 u8b11 :1;
    u8 u8b12 :1;
    u8 u8b13 :1;
    u8 u8b14 :1;
    u8 u8b15 :1;
    u8 u8b0 :1;
    u8 u8b1 :1;
    u8 u8b2 :1;
    u8 u8b3 :1;
    u8 u8b4 :1;
    u8 u8b5 :1;
    u8 u8b6 :1;
    u8 u8b7 :1;  /* msb */
  } strBit;     /* for bit  acces */
  struct
  {
    u8 u8high;
    u8 u8midHigh;
    u8 u8midLow;
    u8 u8low;
  } strByte;    /* for byte acces */
  u32 u32Long;        /* for long acces */
} TYP_tuniPort32;

/*-------------------------- MACRO for handling Byte ------------------------*/

/******************************************************************************/
/*  Return the high byte of a 16-bit word                       */
/******************************************************************************/
#define TYP_u8HIGH_BYTE(\
/*   Input variable*/\
var16)\
/******************************************************************************/\
/* @Pseudo : Shifting to the right 8 bits                                     */\
/******************************************************************************/\
(u8)((var16)>>8)

/******************************************************************************/
/*  Return the low byte of a 16-bit word                        */
/******************************************************************************/
#define TYP_u8LOW_BYTE(\
/*   Input variable*/\
var16)\
/******************************************************************************/\
/* @Pseudo : Mask with 0x00FF                                                 */\
/******************************************************************************/\
(u8)((var16) & (u16)0x00ff)

/******************************************************************************/
/************************** C O N S T A N T S *********************************/
/******************************************************************************/


/*   Definition of the boolean value OFF                           */

#define TYP_u8OFF   (u8)0

/*   Definition of the boolean value ON                            */

#define TYP_u8ON    (u8)1

/*   Definition of the boolean value FALSE                         */

#define TYP_u8FALSE   (u8)0

/*   Definition of the boolean value TRUE                          */

#define TYP_u8TRUE    (u8)1

/*   Definition of the value of Null pointer                       */

#define TYP_vidNULL   (void(*))0

/*   Specify in byte the zero value */

#define TYP_u8ZERO    ((u8)0)
#define TYP_s8ZERO    ((s8)0)

/*   Specify in word the zero value */

#define TYP_u16ZERO   ((u16)0)
#define TYP_s16ZERO   ((s16)0)
#define TYP_u32ZERO   ((u32)0)
#define TYP_s32ZERO   ((s32)0)

/*   Definition of the value DISABLE                               */

#define TYP_u8DISABLE (u8)0

/*   Definition of the value ENABLE                                */

#define TYP_u8ENABLE  (u8)1

/*   Definition of the value NO                                    */

#define TYP_u8NO    (u8)0

/*   Definition of the value YES                                   */

#define TYP_u8YES   (u8)1

/*   Definition of bit 0                                            */
#define BIT0   u8b0
/*   Definition of bit 1                                            */
#define BIT1   u8b1
/*   Definition of bit 2                                            */
#define BIT2   u8b2
/*   Definition of bit 3                                            */
#define BIT3   u8b3
/*   Definition of bit 4                                            */
#define BIT4   u8b4
/*   Definition of bit 5                                            */
#define BIT5   u8b5
/*   Definition of bit 6                                            */
#define BIT6   u8b6
/*   Definition of bit 7                                            */
#define BIT7   u8b7
/*   Definition of bit 8                                            */
#define BIT8   u8b8
/*   Definition of bit 9                                            */
#define BIT9   u8b9
/*   Definition of bit 10                                           */
#define BIT10  u8b10
/*   Definition of bit 11                                           */
#define BIT11  u8b11
/*   Definition of bit 12                                           */
#define BIT12  u8b12
/*   Definition of bit 13                                           */
#define BIT13  u8b13
/*   Definition of bit 14                                           */
#define BIT14  u8b14
/*   Definition of bit 15                                           */
#define BIT15  u8b15

/*   Generic return type                                            */
typedef u8 Std_ReturnType;
/*   Generic return value for success                               */
#define E_OK      1
/*   Generic return value for failure                               */
#define E_NOT_OK  0
/* FIN_INTERFACE_UTILISATEUR *************************************************/

#endif /* LOC_TYPE_H */

/************************* E N D (TYP_Int.h) ********************************/

